# -*- coding: utf-8 -*-
'''
Created on 2013-4-12
系统全局配置
@author: dyq
'''
import ConfigParser              
import codecs
import Cms
from ConfigParser import SafeConfigParser
from StringIO import StringIO

class Config:
    '''
              读取配置文件
    '''
    #用户必须输入数据数组
    UserInput=[1,]
    
    #欢迎用语
    WelCome="欢迎"
    
    #管理员账号
    SysAdminId=""
    
    #是否开发模式
    IsDevelop=False
   
    def __init__(self):
        cf=self.__Get___()
        Config.SysAdminId=cf.get("Sys","SysAdminId")
        Config.IsDevelop=cf.get("Web","IsDevelop")=='True'
    
    def SetAdminId(self,id):
        
        files = Cms.__path__[0]
        config =self.__Get___()
        config.set("Sys", "SysAdminId", id)
        config.write(open(files+"\\config.ini", "wb"))
        
    def __Get___(self):
        files = Cms.__path__[0]
        cf = ConfigParser.ConfigParser()
        cf.readfp(codecs.open(files+"\\config.ini", "r", "utf-8-sig"))  
        return cf
    
        # Config.UserInput=cf.get("info","UserInput").split('|')
        # Config.WelCome=cf.get("info","WelCome")
        

        